<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="__PUBLIC__/css/font.css">
    <link rel="stylesheet" href="__PUBLIC__/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="/">首页</a>
        <a href="">收银台</a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row  layui-form">
        <h3>订单详情</h3>
        <table class="layui-table">
            <tr>
                <td>酒楼名称：</td>
                <td style="text-align: left">{$data.company.name}</td>
            </tr>
            <tr>
                <td>桌号名称：</td>
                <td style="text-align: left">{$data.table_info.isbox} - {$data.table_info.name}</td>
            </tr>
            <tr>
                <td>顾客姓名：</td>
                <td style="text-align: left">{$data.name}</td>
            </tr>
            <tr>
                <td>订单菜品：</td>
                <td style="text-align: left">
                    <foreach name="data.info" item="v">
                        <div style="margin-top:10px; border-bottom:1px solid #CCC; padding-bottom: 10px;">
                            <img src="{$v.image}" alt="" width="200" style="margin-right: 10px;">菜名：{$v.name}&nbsp;&nbsp;价格：￥{$v.price} &nbsp;&nbsp;数量：{$v.num}</div>
                    </foreach>
                </td>
            </tr>
            <tr>
                <td>金额：</td>
                <td style="text-align: left">总价：{$data.price} &nbsp;&nbsp;  已付金额：{$data.havepayed}  &nbsp; &nbsp; 实付金额 ：{$data.shifu_money} &nbsp; &nbsp; 未付金额 ：{$data.weifu_money}&nbsp;&nbsp;
                    <if condition="isset($data['reduce_cost'])">优惠金额：{$data.reduce_cost}</if></td>
            </tr>
            <tr>
                <td>下单时间：</td>
                <td style="text-align: left">{$data.time|date='Y-m-d H:i:s', ###}</td>
            </tr>

            <tr>
                <td>付款方式：</td>
                <td style="text-align: left">
                    <input type="radio" name="money" value="现金" title="现金" checked>
                    <input type="radio" name="money" value="支付宝" title="支付宝">
                    <input type="radio" name="money" value="微信" title="微信" >
                    <input type="radio" name="money" value="刷卡" title="刷卡" >
                    <input type="radio" name="money" value="会员卡" title="会员卡" >
                    <input type="radio" name="money" value="免单" title="签单" >
                </td>
            </tr>

        </table>
        <button class="layui-btn" style="margin-left: 620px;" id="qtjs">清台结算</button>

    </div>

</div>


</body>

</html>
<script>
    $(function () {
        $('#qtjs').click(function () {
            var wfmoney = '{$data.weifu_money}';
            if(wfmoney > 0){
                layer.confirm('此订单有未付金额确定要结算吗？', {icon: 3, title:'提示'}, function(index){
                    // 获取付款方式
                    layer.close(index);
                    // 清台
                    qt();
                });
            } else {
                // 清台
                qt();

            }

        });

        qt = function () {
            var money = $('input[name="money"]:checked').val();
            var data = '{$data.json}';
            $.ajax({
                type: 'POST',
                url: '{:U("Cashier/qtjs_jc")}' ,
                data: {data:data,money:money} ,
                dataType: 'json',
                success: function (res) {
                    layer.msg(res.msg);

                }

            });
        }
    })
</script>